<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,height=device-height,initial-scale=1.0,user-scalable=no,minimum-scale=1.0,maximum-scale=1.0"/>
    <title>首页</title>
    <div th:include="head :: res"></div>
</head>

<body class="container">
<div th:include="head :: header-nav"></div>
<br>
<a class="btn btn-sm btn-primary" th:href="@{/aqroom/form}" sec:authorize="hasAuthority('admin')">添加答疑室</a>
<br>
<table class="table table-hover table-condensed">
    <thead>
    <tr>
        <th>主题</th>
        <th>发布者</th>
        <th>创建时间</th>
        <!--<th>问答数</th>-->
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="aqroom: ${list}">
        <td><a th:text="${aqroom.getName()}" th:href="@{/aqroom/ }+ ${aqroom.getId()}"></a></td>
        <td th:text="${aqroom.getCreateBy().getName()}">
        </td>
        <td th:text="${#dates.format(aqroom.getCreateDate(), 'yyyy-MM-dd HH:mm:ss')}"></td>
        <!--<td th:text="${aqroom.getQuestions().size()}"></td>-->
        <td>
            <a class="btn btn-sm btn-info" th:href="@{/aqroom/form/} + ${aqroom.id}">编辑</a>
            <a class="btn btn-sm btn-danger" th:href="@{/aqroom/delete/} + ${aqroom.id}">删除</a>
        </td>
    </tr>
    </tbody>
</table>
</body>
</html>